/*表单验证*/
(function ($) {
    $.fn.extend({
        "check": function (options) {
            var opts = $.extend({}, defaluts, options);
			var type = opts.type;
			var re ;
			switch (type) {
				case "mobile"://手机号
				re = /(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}/;
				break;
				case "email"://电子邮件
				re = /^\w+[-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
				break;
				case "id_card"://身份证
				re = /^\d{15}|\d{}18$/;
				break;
				case "bank_card"://银行卡
				re = /^(\d{16}|\d{19})$/;
				break;
				case "pw"://密码，以字母开头，长度在6-18之间，只能包含字符、数字和下划线
				re = /^[a-zA-Z]\w{5,17}$/;
				break;
				case "tpw"://交易密码 6位数字
				re = /^\d{6,6}$/;
				break;
				case "nick"://交易密码 6位数字
				re = /^\w\W{2,18}$/;
				break;
			}
			//alert(type+" "+$(this).val())
			//return re
			if(!re.test($(this).val())){
				 return 0
			}else{
				 return 1
			}
			
		}
    });
	var defaluts = {
		type: "mobile"		//验证类型
	}; 
})(window.jQuery);